<?php
/*
	
*/
defined('BY_JYA') or exit('Access Denied');
global $_RQ,$_AR;

$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$return=array();
$return['diy']=$this->plugin_setting('diy');
$basic=$this->plugin_setting('basic');
$return['banner']=$basic['image'];
$return['basic']=$basic;
if($_RQ['op']=='main'){
	
	set_html('title','审核群');
	$return['sum']=pdo_count('jy_onlineedu_video',array('uniacid'=>$_SESSION['uniacid'],'status'=>0),'id');
	exi($return);
}
if($_RQ['op']=='getlist'){
	$return['params']=array();
	$opusall=pdo_getall('jy_onlineedu_video',array('uniacid'=>$_SESSION['uniacid'],'status'=>0));
	foreach($opusall as &$row){
		$row['isvip']=pdo_getcolumn('jy_vote_user',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$row['mid']),'isvip');
	}
	paixu($opusall,'isvip','desc');
	//获取所有待审核的群
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$page =intval($_RQ['page']) ? intval($_RQ['page']) : 1;
	$start = ($page-1)*$psize;
	$list=array_slice($opusall,$start,10);
	//$list=pdo_getslice('jy_onlineedu_video',array('uniacid'=>$_SESSION['uniacid'],'status'=>0),array($pindex,$psize),$total,$fields,'','id asc');
	if($list){
		foreach($list as &$item){
			$item['createtime']=date('Y-m-d H:i:s',$item['createtime']);
			$member=pdo_get('core_members',array('id'=>$item['mid'],'uniacid'=>$_SESSION['uniacid']),array('credit1','credit2','mobile','groupid','avatar','nickname'));
			$item['lealname']=$item['lealname']?$item['lealname']:$member['nickname'];
		}
	}
	$return['list']=$list;
	$return['params']['page'] =$pindex;
	set_html('title','审核群');
	exi($return);
}

if($_RQ['op']=='pass'){
	$postdata=get_postdata();
	if(!$postdata['id']){
		exi('没有找到该群，请重新选择！','error');
	}
	pdo_update('jy_onlineedu_video',array('status'=>1),array('uniacid'=>$_SESSION['uniacid'],'id'=>$postdata['id']));
	$return['ok']=1;
	exi($return);
}
if($_RQ['op']=='unpass'){
	$postdata=get_postdata();
	if(!$postdata['id']){
		exi('没有找到该群，请重新选择！','error');
	}
	pdo_update('jy_onlineedu_video',array('status'=>2),array('uniacid'=>$_SESSION['uniacid'],'id'=>$postdata['id']));
	$return['ok']=1;
	exi($return);
}

